/////////////////////////////////////////////////////////////////////////
// File:        TNod.h
// Purpose:     All declarations of TNodApp class and the ExitWindow frame
// Author:      Tukero
// Modified by: 
// Copyright:   (c) Tukero <tukero@gmail.com>
// Licence:     GNU/LGPL v3
/////////////////////////////////////////////////////////////////////////

#ifndef _TNODAPP_
#define _TNODAPP_

#ifndef _WIN32_IE
#  define _WIN32_IE 0x0501
#elif _WIN32_IE < 0x0501
#  error This application requires Internet Explorer 5.01 or latter
#endif

#ifdef __BORLANDC__
#  pragma hdrstop
#endif

#ifndef WX_PRECOMP
#  include <wx/wx.h>
#else
#  include <wx/wxprec.h>
#endif

#include <windows.h>
#include <wx/config.h>           //for read/write application settings
#include <wx/stdpaths.h>         //application standard paths
#include <wx/listimpl.cpp>
#include <wx/thread.h>

#include "SettingsDlg.h"
#include "DownloadLicensesFrm.h"
#include "TrayIcon.h"
#include "TrayIconThread.h"
#include "License.h"
#include "Utils.h"
#include "version.h"
#include "wx/httpbuilder.h"
#include "NewVersionMsg.h"
#include "Settings.h"
#include "TNodAppBase.h"

enum APPEXTRAMODES
{    
	INITMODE     = 0x01,
	WRITEKEYMODE = 0x02,
    DOWNLOADMODE = 0x04,
    EXPIREMODE   = 0x08,
    DOWNLOADDLGMODE = 0x10
};

// --------------------------------------------------------------------------------------
// main application class
// --------------------------------------------------------------------------------------
class TNodApp : public TNodAppBase
{
private:
    wxThread*       m_TrayIconThread;
    wxFrame*        m_DownloadLicensesFrm;    
    //TrayIcon*       m_TrayIcon;

    void            CloseTNodThreads();
    wxFrame*        m_SettingsDlg;
public:    
    TNodApp();
    //wxThread*       m_TNod;
    //long            m_Mode;
    long            m_ExtraModes;       

    //bool            m_NewVersionFound;
    //bool            m_IsInputFinished;

    //unsigned int    m_validLicenses2Get;
    //int             m_licensesNum2Check;
    //int             m_checkedLicenses;
    wxString        m_file2SaveLicenses;

    wxString        GetTrayIconTitle();
   
    void         Finish();

    virtual bool OnInit(); //For all initializations, show the main frame or commands and others
    virtual int  OnExit();

    wxString     GetBalloonTitle();
    //TrayIcon*    CreateTrayIcon();
    int          CheckCmdLine();
    bool         StartTNod();   
};

DECLARE_APP(TNodApp)

#endif